import wtforms

from validators import BaseForm, BasePageForm


class SchemaFieldForm(BaseForm):
    """
    模型字段表单校验类
    """
    id = wtforms.IntegerField()
    schemaId = wtforms.StringField("所属模型", [wtforms.validators.DataRequired(message="所属模型不能为空")])
    fieldName = wtforms.StringField("字段名称", [wtforms.validators.DataRequired(message="字段名称不能为空")])
    remark = wtforms.StringField("字段注释", [wtforms.validators.DataRequired(message="字段注释不能为空")])
    fieldSize = wtforms.StringField("字段长度")
    dataType = wtforms.StringField("数据类型")
    isPrimary = wtforms.StringField("是否主键")
    nullable = wtforms.StringField("允许为空")
    defaultValue = wtforms.StringField("默认值")
    component = wtforms.StringField("表单组件")
    sort = wtforms.StringField("排序")
    variable = wtforms.StringField("扩展属性JSON")
    createUser = wtforms.StringField("创建用户")
    updateUser = wtforms.StringField("更新用户")
    ext = wtforms.Field("扩展属性JSON")


class SchemaFieldPageForm(BasePageForm):
    """
    模型字段分页校验类
    """
    pass
